package clueless.utilities;

public class Map {
	


	
	
//////////////////////////////////
// Main rooms (i.e., non-hallways)
//////////////////////////////////
	
	
	public Room getStudy() {
		return study;
	}

	public Room getHall() {
		return hall;
	}

	public Room getLounge() {
		return lounge;
	}

	public Room getLibrary() {
		return library;
	}

	public Room getBillardRoom() {
		return billardRoom;
	}

	public Room getDiningRoom() {
		return diningRoom;
	}

	public Room getConservatory() {
		return conservatory;
	}

	public Room getBallroom() {
		return ballroom;
	}

	public Room getKitchen() {
		return kitchen;
	}
	
	public Room getHallBwtnStudyAndHall() {
		return study.getRightRoom();
	}
	
	public Room getHallBwtnHallAndLounge() {
		return hall.getRightRoom();
	}
	
	public Room getHallBwtnLibraryAndBillardRoom() {
		return library.getRightRoom();
	}
	
	public Room getHallBwtnBillardRoomAndDiningRoom() {
		return billardRoom.getRightRoom();
	}
	
	public Room getHallBwtnConservatoryAndBallroom() {
		return conservatory.getRightRoom();
	}
	
	public Room getHallBwtnBallroomAndKitchen() {
		return ballroom.getRightRoom();
	}
	
	public Room getHallBwtnStudyAndLibrary() {
		return study.getDownRoom();
	}
	
	public Room getHallBwtnLibraryAndConservatory() {
		return library.getDownRoom();
	}
	
	public Room getHallBwtnHallAndBillardRoom() {
		return hall.getDownRoom();
	}
	
	public Room getHallBwtnBillardRoomAndBallroom() {
		return billardRoom.getDownRoom();
	}
	
	public Room getHallBwtnLoungeAndDiningRoom() {
		return lounge.getDownRoom();
	}
	
	public Room getHallBwtnDiningRoomAndKitchen() {
		return diningRoom.getDownRoom();
	}
	
	private Room study;
	private Room hall;
	private Room lounge;
	private Room library;
	private Room billardRoom;
	private Room diningRoom;
	private Room conservatory;
	private Room ballroom;
	private Room kitchen;


	private void connectLeftRight(Room leftRoom, Room rightRoom)
	{
		Room hallway = new Room("Hallway between the " + leftRoom.getMyRoom() + " and the " + rightRoom.getMyRoom());
		
		hallway.setLeftRoom(leftRoom);
		hallway.setRightRoom(rightRoom);
		leftRoom.setRightRoom(hallway);
		rightRoom.setLeftRoom(hallway);
	}
	
	private void connectUpDown(Room upRoom, Room downRoom)
	{
		Room hallway = new Room("Hallway between the " + upRoom.getMyRoom() + " and the " + downRoom.getMyRoom());
		hallway.setUpRoom(upRoom);
		hallway.setDownRoom(downRoom);
		upRoom.setDownRoom(hallway);
		downRoom.setUpRoom(hallway);
	}

	public Map() {
		super();
		
		study = new Room(Room.m_STUDY);
		hall = new Room(Room.m_HALL);
		lounge = new Room(Room.m_LOUNGE);
		
		library = new Room(Room.m_LIBRARY);
		billardRoom = new Room(Room.m_BILLIARD_ROOM);
		diningRoom = new Room(Room.m_DINING_ROOM);
		
		conservatory = new Room(Room.m_CONSERVATORY);
		ballroom = new Room(Room.m_BALLROOM);
		kitchen = new Room(Room.m_KITCHEN);
		
		study.setSecretRoom(kitchen);
		kitchen.setSecretRoom(study);
		
		lounge.setSecretRoom(conservatory);
		conservatory.setSecretRoom(lounge);
		
		connectLeftRight(study,hall);
		connectLeftRight(hall,lounge);
		
		connectLeftRight(library,billardRoom);
		connectLeftRight(billardRoom,diningRoom);
		
		connectLeftRight(conservatory,ballroom);
		connectLeftRight(ballroom,kitchen);
		
		connectUpDown(study,library);
		connectUpDown(library,conservatory);
		
		connectUpDown(hall,billardRoom);
		connectUpDown(billardRoom,ballroom);
		
		connectUpDown(lounge,diningRoom);
		connectUpDown(diningRoom,kitchen);
		
	}

}
